package org.openrbac.rbac.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author 梁富贵
 * @Date 2024/4/15
 **/
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    @Value("${context.myself.output-dir}")
    private String staticPath;


    @Override
    public void addResourceHandlers(org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/image/**").addResourceLocations("file:"+staticPath);
        registry.addResourceHandler("/public/image/**").addResourceLocations("file:"+staticPath);
        registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
    }
}
